home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
vgapal.exe
/
VGAPAL.DOC
< prev
next >
Wrap
Text File
|
1993-01-21
|
10KB
|
294 lines
VGApal v1.0
Copyright (c) 1992 RAM Software Development
Roger Madore
RAM Software Development
P.O. Box 2193
Augusta, Maine, 04338-2193
Voice: (207) 623-9248
CIS: 71163,214
Page 1
--------------------
Welcome to VGApal!
--------------------
Contents
--------
2 - Introduction
2 - Installation
3 - Fading
4 - Scrolling
5 - Miscellaneous
6 - List of Procedures
7 - Legal Information
Page 2
INTRODUCTION
Have you ever wanted to be able to create professional looking
fade in and fade out effects? How about palette cycling? Sounds simple,
but in Pascal, all you end up with is a screen full of "flicker".
How about loading PCX files? Now there is something that would make
life easier than having to redraw graphic screens every time you wanted
to display something.
Finally, there is an answer to those problems, and many more.
Fading in, fading out, to either black or white, is a snap! In three
easy steps you can load a PCX file and fade in from black, at whatever
speed you want! Manipulating palette colors and cycling is a breeze,
and all flicker free!
VGApal is the perfect compliment to any Pascal graphic toolbox.
From games and demos to graphic presentations, VGApal will make an
excellent program outstanding!
INSTALLATION
All you need to do is to include VGApal in your Unit Directories
under your Options menu. Then just put "VGApal" in your "Uses" clause
at the beginning of your program, and you're ready to use the toolkit!
Page 3
FADING
There are many different methods of fading. You can fade in and
fade out from either white or black. You can also fade from one color
to another.
Six procedures handle the full palette fading.
SetPalBlack;
SetPalWhite;
FadeInPalBlack(Speed : Integer);
FadeInPalWhite(Speed : Integer);
FadeOutPalBlack(Speed : Integer);
FadeOutPalWhite(Speed : Integer);
SetPalBlack or SetPalWhite should be called before using any of the
other fading procedures. This saves the current palette information into
an array and sets the "visible" colors to either black or white. At this
point, you can either draw your screen or load a PCX file without
anything being shown. REMEMBER: Even though all the palette colors are
either black or white, their original colors are preserved, and will be
restored when you use a fading procedure.
Now you can fade in from black or white using FadeInPalBlack or
FadeInPalWhite. Speed can be an integer from 1 to 100. The higher the
number, the slower the fade in. If you want the image to "pop" up on the
screen, set the speed to 1.
Fading out is just as easy. Speed determines the speed at which the
the palette fades to black or white. The actual palette will still be
preserved in the array that was constructed with SetPalBlack or
SetPalWhite.
NOTE: No error checking is performed in the Speed variable. This
was for speed considerations. You can use larger numbers, but you may
get unpredictable results!
For a quick example, your code could be something like this:
Program Sample;
Uses Graph, VGApal;
{VGA 320 x 200 initialization code}
SetPalBlack;
{Draw or load images}
FadeInPalBlack(15);
{Perform other functions}
FadeOutPalBlack(80);
End.
Page 4
SCROLLING
Palette scrolling can create some of the most impressive animation
sequences ever. VGApal offers five palette scrolling procedures that are
fast and easy to use.
CyclePalAhead;
CyclePalBack;
CycleColAhead(First, Last : Integer);
CycleColBack(First, Last : Integer);
SwitchCol(First, Second : Integer);
CyclePalAhead and CyclePalBack scrolls the entire palette by shifting
all the colors in the palette table by increments of one. The color that
scrolls off of the end wraps to the other. For example, if you execute
CyclePalAhead:
0,1,2...253,254,255 would become 255,0,1...252,253,254
CyclePalAhead and CyclePalBack only shift the palette once per call.
You would have to create a loop to have continuous palette cycling.
CycleColAhead and CycleColBack work the same as CyclePalAhead and
CyclePalBack, except that you specify the range of colors that are
cycled. So if you execute CycleColAhead(3,7):
0,1,2,3,4,5,6,7,8,9 would become 0,1,2,7,3,4,5,6,8,9
SwitchCol is very straight forward. Just specify the two colors to
switch. For instance, SwitchCol(3,8):
0,1,2,3,4,5,6,7,8,9 would become 0,1,2,8,4,5,6,7,3,9
Page 5
MISCELLANEOUS
A few procedures just didn't seem to fit into any other category,
but they are no less impressive!
SaveColorFrom(Color : Integer);
FadeColorTo(Color, Speed : Integer);
SavePal;
RestPal;
Read256PCX(Filename : PathStr);
SaveColorFrom will save the RGB information from the specified color
into the array SColor[0..2]. This function is useful if you want to
retrieve color information quickly, and is also used in FadeColorTo.
The SColor[0..2] array can be manipulated directly by your program, and
can be helpful if you need to use a color that doesn't already exist.
FadeColorTo will take the color information in SColor[0..2], and
smoothly fade it into the specified color, at the predefined speed.
Some spectacular results can be realized with these two procedures.
SavePal does just as it implies. It saves your current palette in an
array. Its compliment is RestPal, which restores all the palette colors
to the previously save colors.
Read256PCX reads a 320 x 200 with 256 colors PCX file directly into
memory. It is displayed very quickly, and has superb results with the
fading procedures.
NOTE: There is not any error checking done for these procedures.
Error handling is left up to the individual programmer.
Page 6
LIST OF PROCEDURES
CycleColAhead(First, Last : Integer);
Cycles colors ahead from First color to Last color.
CycleColBack(First, Last : Integer);
Cycles colors backwards from First color to Last color.
CyclePalAhead;
Cycles the entire palette ahead.
CyclePalBack;
Cycles the entire palette backwards.
FadeColorTo(Color, Speed : Integer);
Fades colors from SColor[0..2] to Color at Speed.
FadeInPalBlack(Speed : Integer);
Fades in from black to colors saved in SetPalBlack or
SetPalWhite at Speed.